import {
	defineStore
} from 'pinia'
import {
	useUserStore
} from './user'


const userStore = useUserStore()

// loading
export const useLoadingStore = defineStore('loading', {
	// state
	state: () => ({
		type: '',
		backgroundImage: 'https://qiniu.zdbty.net/g8LtkTUpJjDh.gif',
		text: '加载中...',
		isShow: true,
		color: '#fff'
	}),



	// action
	actions: {
		hideLoading() {
			this.type = '';
			this.isShow = false
		},
		showLoading(obj) {
			if (obj.type) this.type = obj.type;
			if (obj.text) this.text = obj.text;
			if (obj.backgroundImage) this.backgroundImage = obj.backgroundImage;
		}
	}
})